#include <iostream>
#include <chrono>
#include <cmath>
#include "func.h"
struct best
{
   double f;
   double h;
};
using namespace std;
int main(int argc, char **argv) {
    double max,min;
    double f,h;
    f =0;
    h =0.6;
    double dt = 0.0001;
    struct best temp;
    temp.f = 1;
    temp.h = 0;
    min = cost(&temp.f, &temp.h,-150,150);
    cout<<min<<endl;
    double o=-PI/6;
    for(int i=460;i<(1/0.0001);i++){
        for(int j=0;j<(0.6/0.0001);j++){
            f = (double)i*0.0001;
            h = (double)j*0.0001;
            if(((F*R-R)>=onleft(f,h,150))&&((F*R-R)<=onright(f,h,150))){
                    if(ismatch(f,h)){
                        //printf("%.4f,%.4f  ",f,h);
                        if(cost(&f,&h,-150,150)<min)
                        {
                         temp.f = f;
                         temp.h = h;
                         min =cost(&temp.f, &temp.h,-150,150);
                        }
                    }
            }        
        }
    }
    printf("f=");
    std::cout<<temp.f<<endl;
    printf("h=");
    std::cout<<temp.h<<endl;
    printf("cost=");
    std::cout<<cost(&temp.f, &temp.h,-150,150)<<endl;
    std::cout<<min<<endl;
    return 0;
}